<?php

namespace app\index\controller\consulting;

use app\index\model\UM as UM;
use app\index\service\LawCaseService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * LawCase 控制器
 * Class LawCase
 * @package app\consulting\controller
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 */
class LawCase
{
    // 请求参数
    private Request $request;

    // service
    private LawCaseService $service;

    public function __construct(Request $request, LawCaseService $lawCaseService)
    {
        $this->request = $request;
        $this->service = $lawCaseService;
    }
    /**
     * 提交案源
     * @param UM $user
     * @return ApiResponse
     * @url /consulting/law_case/save
     */
    public function save(UM $user): ApiResponse
    {
        $request     = $this->request;

        $data = $this->service->addConsultingLawCase($user, $request->param());

        return ApiResponse::success($data);
    }
}
